package com.shell.arouter.demo.mdc

import com.alibaba.android.arouter.facade.annotation.Route
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.henanjianye.soon.communityo2o2.R
import com.shell.arouter.ui.FragmentCommon
import kotlinx.android.synthetic.main.fragment_mdc.*

/**
 * 说明：FragmentIOTest
 * <p/>
 * 作者：fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2020-02-24 17:35
 * <p/>
 * 版本：version 1.0
 */
@Route(path = "/mdc/mdc")
class FragmentMdc : FragmentCommon() {

    override fun isShowTitleBar(): Boolean {
        return true
    }

    override fun isShowTitleBarBack(): Boolean {
        return true
    }

    override fun bindTitleBarText(): String {
        return "MDC"
    }

    override fun getRootViewResID(): Int {
        return R.layout.fragment_mdc
    }

    override fun onFirstUserVisible() {
        super.onFirstUserVisible()
        btnText.setOnClickListener {
            MaterialAlertDialogBuilder(activity)
                    .setTitle("Title")
                    .setMessage("Message")
                    .setPositiveButton("Ok", null)
                    .show()
        }
        btnOutlined.setOnClickListener {
            MaterialAlertDialogBuilder(activity, R.style.demo_alert_dialog)
                    .setTitle("Title")
                    .setMessage("Message")
                    .setPositiveButton("Positive") { dialog, which ->
                        dialog.dismiss()
                    }
                    .show()
        }
    }

}